//
// Created by kenny on 25-10-15.
//
#ifndef MCP_LOGGER_H
#define MCP_LOGGER_H
    #define LOG_LEVEL_DEBUG 0
    #define LOG_LEVEL_INFO  1
    #define LOG_LEVEL_WARN  2
    #define LOG_LEVEL_ERROR 3

    // 使用宏简化调用
    #define LOG_DEBUG(...) logger_write(0, __FILE__, __LINE__, __VA_ARGS__)
    #define LOG_INFO(...)  logger_write(1, __FILE__, __LINE__, __VA_ARGS__)
    #define LOG_WARN(...)  logger_write(2, __FILE__, __LINE__, __VA_ARGS__)
    #define LOG_ERROR(...) logger_write(3, __FILE__, __LINE__, __VA_ARGS__)

    int logger_init(const char *filename, int level, int use_console);
    void logger_cleanup();
    void logger_write(int level, const char *file, int line, const char *fmt, ...);
#endif //MCP_LOGGER_H
